package com.hao.study.service.impl;

import com.google.code.kaptcha.impl.DefaultKaptcha;
import com.hao.study.service.CaptchaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.awt.image.BufferedImage;

@Service
public class CaptchaServiceImpl implements CaptchaService {

    @Autowired
    private DefaultKaptcha defaultKaptcha;

    public BufferedImage createCaptcha(String captchaText) {
        return defaultKaptcha.createImage(captchaText);
    }

    public String createCaptchaText() {
        return defaultKaptcha.createText();
    }
}
